unit rpSHYB;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uClassReport, cxGraphics, cxControls,
  cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  cxPCdxBarPopupMenu, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage,
  Data.DB, cxDBData, Vcl.Menus, Data.Win.ADODB, Vcl.ImgList, Vcl.ActnList,
  cxPropertiesStore, Vcl.StdCtrls, cxButtons, cxGridLevel, cxClasses,
  cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  cxGrid, cxPC, cxGroupBox, cxTextEdit, cxMaskEdit, cxDropDownEdit,
  cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxHeader, cxSpinEdit,
  cxCheckBox;

type
  TfmrpSHYB = class(TfmClassReport)
    Label6: TLabel;
    lcActionGrupList: TcxLookupComboBox;
    aqActionList: TADOQuery;
    dsActionList: TDataSource;
    grdReportsYeterlilikNo: TcxGridDBColumn;
    grdReportdteBelgeOnayTrh: TcxGridDBColumn;
    grdReportdteBelgeGecTrh: TcxGridDBColumn;
    grdReportsSehir: TcxGridDBColumn;
    grdReportsKapsam: TcxGridDBColumn;
    grdReportsAdres: TcxGridDBColumn;
    grdReportsUnvan: TcxGridDBColumn;
    grdReportsStdNo: TcxGridDBColumn;
    grdReportsDurumu: TcxGridDBColumn;
    grdReportsTelefon: TcxGridDBColumn;
    grdReportsFax: TcxGridDBColumn;
    grdReportsVergiDaire: TcxGridDBColumn;
    grdReportsVergiNo: TcxGridDBColumn;
    grdReportsMail: TcxGridDBColumn;
    grdReportYTSsFirmaAd: TcxGridDBColumn;
    grdReportYTSYetkiliAdSoyad: TcxGridDBColumn;
    grdReportYTSsSehirAd: TcxGridDBColumn;
    grdReportYTSsAdres: TcxGridDBColumn;
    grdReportYTSsVergiNo: TcxGridDBColumn;
    grdReportYTSsVergiDaire: TcxGridDBColumn;
    grdReportYTSsTelefon: TcxGridDBColumn;
    grdReportsActionGrup: TcxGridDBColumn;
    grdReportKalanGun: TcxGridDBColumn;
    grdReportsILCE: TcxGridDBColumn;
    Label7: TLabel;
    Label8: TLabel;
    edYTS: TcxTextEdit;
    edAnaFirma: TcxTextEdit;
    Label5: TLabel;
    seKalGunBas: TcxSpinEdit;
    seKalGunBit: TcxSpinEdit;
    Label1: TLabel;
    grdReportsDurumu2: TcxGridDBColumn;
    aqTseNo: TADOQuery;
    dsTseNo: TDataSource;
    Label2: TLabel;
    lcTseNo: TcxLookupComboBox;
    grdReportTSENo: TcxGridDBColumn;
    cbYururluk: TcxCheckBox;
    grdReportBolge: TcxGridDBColumn;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure acListExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmrpSHYB: TfmrpSHYB;

implementation

uses Data;

{$R *.dfm}

procedure TfmrpSHYB.acListExecute(Sender: TObject);
var
  ExCursor: TCursor;
begin
  inherited;
  ExCursor := Screen.Cursor;
  Screen.Cursor := crSQLWait;
  try
    with aqList do
    begin
      Close;
      SQL.Text := 'EXEC SP_SHYB @ActionGrup=:ActionGrup,@YTS=:YTS,@AnaFirma=:AnaFirma,@KalanGunBas=:KalanGunBas,@KalanGunBit=:KalanGunBit,@TseNo=:TseNo,@Yururluk=:Yururluk';

      if Trim(lcActionGrupList.Text) = '' then
        Parameters.ParamByName('ActionGrup').Value := NULL
      else
        Parameters.ParamByName('ActionGrup').Value := lcActionGrupList.EditValue;

      Parameters.ParamByName('YTS').Value := edYTS.Text;
      Parameters.ParamByName('AnaFirma').Value := edAnaFirma.Text;
      Parameters.ParamByName('KalanGunBas').Value := seKalGunBas.Value;
      Parameters.ParamByName('KalanGunBit').Value := seKalGunBit.Value;
      Parameters.ParamByName('TseNo').Value := lcTseNo.EditValue;
      Parameters.ParamByName('Yururluk').Value := cbYururluk.Checked;
      Open;
    end;
  finally
    Screen.Cursor := ExCursor;
  end;
end;

procedure TfmrpSHYB.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
  fmrpSHYB := nil;
end;

procedure TfmrpSHYB.FormCreate(Sender: TObject);
begin
  inherited;
  aqActionList.Close;
  aqActionList.Open;

  aqTseNo.Close;
  aqTseNo.Open;
end;

end.
